//
//  PCDKeyBoardManage.m
//  PCDBankSix
//
//  Created by DK on 2022/4/27.
//

#import "PCDKeyBoardManage.h"

@implementation PCDKeyBoardManage

+(PCDKeyBoardManage *)shareInstance{
    
    static PCDKeyBoardManage *singleton =nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        singleton =[[PCDKeyBoardManage alloc] init];
        
        singleton.keyBoardList = [[NSMutableArray alloc] init];
    });
    
    return singleton;
}

-(void)hideKeyBoard
{
    for (int i =0; i<self.keyBoardList.count; i++) {
        
        NSDictionary *tempDic = [self.keyBoardList objectAtIndex:i];
        
        YTKeyboardView *customKeyBoard = [tempDic objectForKey:KeyBoardDATA];
        UIControl *view = [tempDic objectForKey:ViewSheetDATA];
        
        if (customKeyBoard) {
            [customKeyBoard dismiss];
        }
        customKeyBoard = nil;
        
        if (view) {
            [view removeFromSuperview];
        }
        view = nil;
        
        [self.keyBoardList removeObject:tempDic];
    }

}
@end
